package com.example.project_springboot.mapper;

import com.example.project_springboot.pojo.Dept;
import org.apache.ibatis.annotations.*;

import java.util.List;

/**
 * 部门管理
 */
@Mapper
public interface DeptMapper {
    @Select("select * from dept")
    List<Dept> find();

    @Insert("insert into dept(id,name,create_time,update_time) values (#{id},#{name},#{createTime},#{updateTime}) ")
    void insertDept(Dept dept);

    @Delete("delete from dept where id = #{id}")
    void deleteById(Integer id);
    @Update("update dept set name = #{name}, update_time = #{updateTime} where id = #{id}")
    void update(Dept dept);
    @Select("select * from dept where id = #{id}")
    Dept selectById(Integer id);
    @Delete("delete from emp where dept_id = #{deptId}")
    void deleteByEmpId(Integer dept_id);
}
